Skip to content

[Chakra V3 Upgrade 🎨] Create Skip Nav Components (@W-18507873@)#2757

Merged
adamraya merged 9 commits intofeature/chakra-ui-upgrade-v3from
W-18507873-create-v3-skipnav
Jul 15, 2025
Merged

[Chakra V3 Upgrade 🎨] Create Skip Nav Components (@W-18507873@)#2757
adamraya merged 9 commits intofeature/chakra-ui-upgrade-v3from
W-18507873-create-v3-skipnav

Conversation

@adamraya
Copy link
Contributor

@adamraya adamraya commented Jul 8, 2025

Description

This PR implements the SkipNavLink and SkipNavContent components mimicking the equivalent Chakra UI v2 @chakra-ui/skip-nav package, which doesn't exist in Chakra UI v3.

Chakra UI v2's skip nav components:

skipnav.mov

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • Added SkipNavLink and SkipNavContent components that renders hidden-by-default skip navigation link the skip focus target.
  • Updated jest config and added tests.

How to Test-Drive This PR

  1. Start the template-typescript-minimal dev server: npm start
  2. Click the browser's address bar to navigate to any page. E.g.Home page: http://localhost:3000/
  3. Hit Enter to reload the page and press Tab.
  4. Verify that Skip Nav Link is visible in the upper left corner and with the link focused press Enter and verify the focus moves to the main content area.

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@adamraya adamraya requested a review from a team as a code owner July 8, 2025 22:00
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jul 8, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)


describe('SkipNavLink', () => {
test('renders with default props', () => {
render(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can we use renderWithProviders?

const styles = recipe()

return (
<Box id={id} css={[styles.content, css]} tabIndex={-1} {...props}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an object speading instead of array? 🤔 First time seeing this syntax.

Suggested change
<Box id={id} css={[styles.content, css]} tabIndex={-1} {...props}>
<Box id={id} css={{...styles.content, ...css}} tabIndex={-1} {...props}>

}
},
content: {
// tabIndex needs to be set as a prop, not a style
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this comment be here?

height: 'auto !important',
overflow: 'visible !important',
zIndex: 'skipNav',
padding: '8px',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use padding: 2 to get the theme value?

textDecoration: 'none',
border: '2px solid black',
borderRadius: '4px',
fontSize: '14px',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use fontSize: 'sm'?

textDecoration: 'none',
border: '2px solid black',
borderRadius: '4px',
fontSize: '14px',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move it to base instead declaring same value for _focus and _focusVisible

@adamraya adamraya merged commit 3e8d7b7 into feature/chakra-ui-upgrade-v3 Jul 15, 2025
33 checks passed
@adamraya adamraya deleted the W-18507873-create-v3-skipnav branch July 15, 2025 21:54
alexvuong pushed a commit that referenced this pull request Jul 16, 2025
* init

* Clean up styles

* PR Feedback

* Use zIndex value

* Use zIndex default skipNav value

* PR Feedback

* Fix copyright year

* Use token values instead of px

* Move styles to base
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants